/**
* File: globals.h
* \brief Game definitions and variables.
*
* \author Instituto Superior Tecnico de Lisboa, Portugal
* \author Technical University of Lisbon, Portugal
* 
* \author Agentes Autonomos e Sistemas Multiagente
* \author Autonomous Agents and Multiagent Systems
* 
* \version	1.0
* \date		2006/2007
**/
#pragma once

namespace game
{
	class World;

	//=============================================================================
	// Constants and definitions
	//=============================================================================
	/**  
	* \brief Map name maximum length.
	**/
#define MAP_NAME_MAX_SIZE 32
	/** 
	* \brief The number of weapon types.
	**/
#define NUM_WEAPONS		26
	/** 
	* \brief Maximum weapon number.
	**/
#define MAX_WEAPONS		32
	/** 
	* \brief Primary weapons.
	**/
#define WEAPON_PRIMARY ((1<<WeaponIds::m3) | (1<<WeaponIds::xm1014) | \
	(1<<WeaponIds::mac10) | (1<<WeaponIds::tmp) | \
	(1<<WeaponIds::mp5Navy) | (1<<WeaponIds::ump45) | \
	(1<<WeaponIds::p90) | (1<<WeaponIds::famas) | \
	(1<<WeaponIds::galil) | (1<<WeaponIds::ak47) | \
	(1<<WeaponIds::scout) | (1<<WeaponIds::m4A1) | \
	(1<<WeaponIds::aug) | (1<<WeaponIds::sg550) | \
	(1<<WeaponIds::sg552) | (1<<WeaponIds::awp) | \
	(1<<WeaponIds::g3Sg1) | (1<<WeaponIds::m249))
	/** 
	* \brief Secondary weapons.
	**/
#define WEAPON_SECONDARY ((1<<WeaponIds::glock18) | (1<<WeaponIds::usp) | \
	(1<<WeaponIds::p228) | (1<<WeaponIds::dEagle) | \
	(1<<WeaponIds::elite) | (1<<WeaponIds::fiveSeven))

	/**  
	* \brief Grenade timer.
	**/
	static const float GRENADE_TIMER = 1.8f;

	/** 
	* \brief He grenade model name.
	**/
	static const char* HeGrenadeModelName  = "hegrenade.mdl";
	/** 
	* \brief Flashbang model name.
	**/
	static const char* FlashbangModelName  = "flashbang.mdl";
	/** 
	* \brief Smoke grenade model name.
	**/
	static const char* SmokeGrenadeModelName = "smokegrenade.mdl";
	/** 
	* \brief Bomb model name.
	**/
	static const char* SetBombModelName = "c4.mdl";
	/** 
	* \brief Bomb in bag model name.
	**/
	static const char* DroppedBombModelName = "backpack.mdl";

	//=============================================================================
	// Enumerations
	//=============================================================================
	/** 
	* \brief Half-Life engine ids for weapons.
	**/
	class WeaponIds{
	public:
		/** 
		* \brief Half-Life engine ids for weapons. 
		**/
		enum Enumeration{
			/** The 228 Compact pistol. **/
			p228			= 1,
			/** The shield gun. **/
			shieldGun		= 2,
			/** The Schmidt Scout rifle. **/
			scout			= 3,
			/** The HE grenade. **/
			heGrenade		= 4,
			/** The Lone YG1265 Auto shotgun. **/
			xm1014			= 5,
			/** The C4 explosive. **/
			c4				= 6,
			/** The Ing MAC-10 SMG. **/
			mac10			= 7,
			/** The Bullup rifle. **/
			aug				= 8,
			/** The Smoke grenade. **/
			smokeGrenade	= 9,
			/** The .40 Dual Elites pistol. **/
			elite			= 10,
			/** The ES Fi-Seven pistol. **/
			fiveSeven		= 11,
			/** The KM UMP45 SMG. **/
			ump45			= 12,
			/** The Krieg 550 Commando rifle. **/
			sg550			= 13,
			/** The IDF Defender rifle. **/
			galil			= 14,
			/** The Clarion 5.56 rifle. **/
			famas			= 15,
			/** The KM .45 Tactical pistol. **/
			usp				= 16,
			/** The 9x19mm Sidearm pistol. **/
			glock18			= 17,
			/** The Magnum Sniper rifle. **/
			awp				= 18,
			/** The KM SBM. **/
			mp5Navy			= 19,
			/** The M249 machine gun. **/
			m249			= 20,
			/** The Leone 12 Gauge Super shotgun. **/
			m3				= 21,
			/** The Maverick M4A1 rifle. **/
			m4A1			= 22,
			/** The Schmidt Machine Pistol SMG. **/
			tmp				= 23,
			/** The D3/AU-1 rifle. **/
			g3Sg1			= 24,
			/** The Flashbang grenade. **/
			flashBang		= 25,
			/** The Night Hawk .50c pistol. **/
			dEagle			= 26,
			/** The Krieg 552 rifle. **/
			sg552			= 27,
			/** The CV-47 rifle. **/
			ak47			= 28,
			/** The Knife. **/
			knife			= 29,
			/** The ES C90 SMG. **/
			p90				= 30,
			/** The Vest. **/
			vest,
			/** The Vest + Helmet. **/
			vestHelm,
			/** The Defuser Kit. **/
			defuser,
			/** The Night Vision Goggles. **/
			nightVisionGoggles,
			/** The primary ammunition. **/
			ammoPrimary,
			/** Secondary ammunition. **/
			ammoSecondary,
			/** Null. **/
			null = -1
		};
	};
	/** 
	* \brief Weapon data
	**/
	typedef struct WeaponInfo_s
	{
		/**
		* \brief The weapon engine id.
		**/
		int id;
		/**
		* \brief The weapon engine name.
		**/
		const char *name;
		/**
		* \brief The model name.
		**/
		const char *model;
		/**
		* \brief The weapon price.
		**/
		int price;
	} WeaponInfo;

	/** 
	* \brief Weapon data. 
	**/
	typedef struct Weapon_s
	{
		/**
		* \brief The class name.
		**/
		char classname[64];
		/**
		* \brief Ammo index for primary ammo.
		**/
		int ammo;
		/**
		* \brief Max primary ammo.
		**/
		int ammoMax;
		/**
		* \brief HUD slot (0 based).
		**/
		int slot;
		/**
		* \brief Slot position.
		**/
		int slotPosition;
		/**
		* \brief Weapon ID.
		**/
		int id;
		/**
		* \brief Flags.
		**/
		int flags;
	} Weapon;


	/** 
	* \class CounterStrikeTeams
	* \brief Counter-strike teams. 
	**/
	class CounterStrikeTeams{
	public:
		enum Enumeration
		{
			/** A terrorist agent **/
			terrorist = 1, 
			/** A counter-terrorist agent **/
			counterTerrorist, 
		};
	};

	/** 
	* \class MapTypes
	* \brief Map types. **/
	class MapTypes{
	public:
		enum Enumeration
		{
			/** VIP assassination maps **/
			assassination	= (1 << 0),
			/** Hostage rescue maps **/
			hostageRescue	= (1 << 1),
			/** Bomb defusion maps **/
			bombDefuse		= (1 << 2),
			/** Unknown **/
			unknown = 0
		};
	};

	//=============================================================================
	// Global variables
	//=============================================================================
	/** 
	* \brief The world.
	**/
	extern World* g_world;
	/** 
	* \brief Last frame time duration.
	**/
	extern float g_frameDuration;
	/** 
	* \brief The time the previous frame was rendered.
	**/
	extern float g_previousFrameTime;
	/**  **/
	extern int g_msecVal;
	/** 
	* \brief Weapons and their specifications.
	**/
	extern WeaponInfo g_weapons[NUM_WEAPONS + 11];
	/** 
	* \brief Weapon definitions.
	**/
	extern Weapon g_weaponDefinitions[MAX_WEAPONS]; 
}
